package com.derbysoft.ota.infrastructure.context;

import com.google.common.base.Preconditions;

public abstract class RoutingContextHolder {

	private static ThreadLocal<RoutingContext> contextHolder = new InheritableThreadLocal<RoutingContext>();
	
	public static void set(RoutingContext routingContext) {
		contextHolder.set(routingContext);
	}

	public static RoutingContext get() {
		return Preconditions.checkNotNull(contextHolder.get(), "Context holder hasn't been setted.");
	}

}
